home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0643B.ZIP
/
SAY2FILE.DOC
< prev
next >
Wrap
Text File
|
1987-04-17
|
3KB
|
82 lines
*** SAY2FILE.ASM
Say2file.ASM (May p. 3, dBASE III PLUS)
Say2File is an assembly language program that redirects printer output to
a text file, allowing you to send @...SAY's to a disk file rather than to
the printer. Normally, dBASE III PLUS sends printer output through a
printer file handle, namely the printer specified by the SET PRINTER TO
command. Say2File forces DOS to write to a different file handle, the
file you specify. It does not change the operation of dBASE III PLUS in
any way. It simply redirects output at the DOS level.
Before using Say2file, you must LOAD it from within dBASE III PLUS to make
it available to your programs. To do this, execute the command:
LOAD Say2file
Say2File is called twice in a program: once to create a text file and
redirect the printer output, and another to close the file and restore the
printer output to its default device. To open a file, send "O" (for
"open") and the text filename as the memory variable parameter:
mvar = "O<filespec>"
CALL Say2File WITH mvar
where <filespec> is the text filename, including the drive and path if
necessary. If you do not specify a file extension, the file Say2file
creates will not have one.
To now direct output to the disk file you've specified, just give the
command SET DEVICE TO PRINT as if you were printing to the printer. All
output generated by @...SAY's will go to the specified disk file.
To close the text file and restore the default print device, use this
command syntax:
mvar = "C"
CALL Say2File WITH mvar
The parameters you send must be memory variables since Say2file returns
DOS error codes and needs a place to return them. If there are no errors,
Say2file returns a space as the first character of the return memory
variable. Otherwise, the first character is one of the following error
codes:
Error Code Description
========== =====================================================
Space No error occurred.
A Activity error. Occurs when the output file is open
and you CALL Say2File to open it again. It also
occurs when the output file is closed and you CALL
Say2File to close it.
C Close error. DOS cannot close the output file.
D DOS cannot duplicate the printer file handle. Could
be caused by too many files open.
O Open error. DOS cannot open the text file. Could be
caused by too many files open, an invalid filename,
or attempting to write to a read-only file or
directory.
R DOS cannot perform the redirection.
S Syntax error. The parameter being passed is not
structured correctly. It can occur when you
send an empty string as the parameter.
Though Say2file.BIN is included on this diskette, you may wish to assemble
it yourself. To assemble Say2File.ASM to a .BIN file, the following files
must be available, either in the same subdirectory as Say2File.ASM or
through the DOS PATH command: MASM.EXE, LINK.EXE, and EXE2BIN.EXE. Follow
the steps below to assemble Say2File.ASM as a .BIN file:
MASM Say2File.ASM;
LINK SAY2FILE;
EXE2BIN SAY2FILE
ERASE SAY2FILE.EXE
ERASE SAY2FILE.OBJ